try:
    # a = "python"
    print(a)
    print(a.index("oof"))

except NameError as e:
    print("未找到变量a请定义：%s" % str(e))
except ValueError as e:
    print("子字符串没找到：%s" % str(e))
